<script setup lang="ts">
import { ColorPicker } from 'vue-accessible-color-picker'
defineProps<{
    showColor: Boolean
    curColor: string
}>()
const emits = defineEmits(['setColorVal', 'closePicker'])


const setColorVal = (e: { cssColor: string }) => {
    emits('setColorVal', e.cssColor)
}

</script>
<template>
    <div ref="picker" class="color-picker" v-show="showColor">
        <div class="cont">
            <ColorPicker :color="curColor" @color-change="setColorVal" />
            <div class="btns">
                <button class="btn" @click="emits('closePicker')">
                    确定
                </button>
            </div>
        </div>
    </div>
</template>
<style scoped>
.color-picker {
    position: fixed;
    left: 0px;
    top: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 9999;
    color: #000;
}

.cont {
    width: 20rem;
    background-color: #fff;
    padding: 0.5rem;
}

.btns{
    text-align: center;
}
</style>